package com.elong.businesstravel.base.recorder.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.ImageView;

public class LoadingImageView extends ImageView
{
  private int color = 0xfff1dace;
  private float cur = 0;
  private Paint paint;

  public LoadingImageView(Context paramContext)
  {
    super(paramContext);
    initPaint(paramContext);
  }

  public LoadingImageView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    initPaint(paramContext);
  }

  public LoadingImageView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    initPaint(paramContext);
  }

  private void initPaint(Context paramContext)
  {
    Paint localPaint = new Paint();
    this.paint = localPaint;
    this.color = 0xfff1dace;
  }

  protected void onDraw(Canvas paramCanvas)
  {
    Paint localPaint1 = this.paint;
    int i = this.color;
    localPaint1.setColor(i);
    float left = getLeft();
    float top = getTop() + (1-cur)*getHeight();
    float right = getRight();;
    float bottom = getBottom();
    
    paramCanvas.drawRect(left, top, right, bottom, localPaint1);
    super.onDraw(paramCanvas);
  }

  public void setProgressColor(int paramInt)
  {
    this.color = paramInt;
  }


  public void updateLoading(float percent)
  {
    this.cur = percent;

      invalidate();
  }
}
